package com.suixingfu.dao;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.fastjson.JSONObject;
import com.suixingfu.vo.FukuanVo;

public class DatabaseDao {

	//格式化时间
	static SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMddHHmmss");
	static Date curDate=new Date(System.currentTimeMillis());//获取当前时间
	static String formatDate=formatter.format(curDate);
	
	//存入数据库
	public static void insertIntoDatabase(FukuanDao fukuandao,JSONObject j1,JSONObject j2,String payItems,int fukuanStatus){
		FukuanVo fkvo=new FukuanVo();
		fkvo.setClientId(j1.getString("clientId"));
		fkvo.setVersion(j1.getString("version"));
		fkvo.setReqId(j1.getString("reqId"));
		fkvo.setTranCd(j1.getString("tranCd"));
		fkvo.setReqData(j1.getString("reqData"));
		fkvo.setPayItems(payItems);
		fkvo.setSubmittime(formatDate);
		System.out.println("database_formatDate="+formatDate);
		fkvo.setFukuanStatus(fukuanStatus);
		fkvo.setResCode(j2.getString("resCode"));
		fkvo.setResData(j2.getString("resData"));
		fkvo.setResMsg(j2.getString("resMsg"));
		fukuandao.insert(fkvo);
		
	}
}
